package com.TestDemo.Test202203To04;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/06/17/11:14
 * @Description:
 * @Target:
 */
public class 全排列 {
    public static void main(String[] args) {
        int[] ints = new int[]{1,2,3};


        for (int i = 0; i < ints.length; i++) {
           
            process(ints,i);
            System.out.println();
        }
        
    }
    
    static ArrayList<String> list;    
    
    static String process(int[] ints,int index){
        StringBuffer ss = new StringBuffer();
       
        System.out.print(ints[index]+" ");

        for (int i = 0; i < ints.length; i++) {
            boolean[] flag = new boolean[ints.length];
            if (flag[i] == true){
                return "";
            }
            flag[i] = true;
            process(ints,i);
        }
        return ss.toString();
    }
}
